import { useCallback } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { setToken } from '../action';
import { getStateToken } from '../getter/user';
export const useStateToken = () => useSelector(getStateToken);

export function useDispatchUser() {
  const dispatch = useDispatch();
  const stateSetToken = useCallback((Token: string) => dispatch(setToken(Token)), [dispatch]);

  return {
    stateSetToken,
  };
}
